home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 21
/
Cream of the Crop 21 (Terry Blount) (October 1996).iso
/
os2
/
e33el2.zip
/
emacs
/
19.33
/
lisp
/
diary-lib.el
< prev
next >
Wrap
Lisp/Scheme
|
1996-05-27
|
63KB
|
1,391 lines
;;; diary-lib.el --- diary functions.
;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1995 Free Software
;; Foundation, Inc.
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
;; Keywords: calendar
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; This collection of functions implements the diary features as described
;; in calendar.el.
;; Comments, corrections, and improvements should be sent to
;; Edward M. Reingold Department of Computer Science
;; (217) 333-6733 University of Illinois at Urbana-Champaign
;; reingold@cs.uiuc.edu 1304 West Springfield Avenue
;; Urbana, Illinois 61801
;;; Code:
(require 'calendar)
;;;###autoload
(defun diary (&optional arg)
"Generate the diary window for ARG days starting with the current date.
If no argument is provided, the number of days of diary entries is governed
by the variable `number-of-diary-entries'. This function is suitable for
execution in a `.emacs' file."
(interactive "P")
(let ((d-file (substitute-in-file-name diary-file))
(date (calendar-current-date)))
(if (and d-file (file-exists-p d-file))
(if (file-readable-p d-file)
(list-diary-entries
date
(cond
(arg (prefix-numeric-value arg))
((vectorp number-of-diary-entries)
(aref number-of-diary-entries (calendar-day-of-week date)))
(t number-of-diary-entries)))
(error "Your diary file is not readable!"))
(error "You don't have a diary file!"))))
(defun view-diary-entries (arg)
"Prepare and display a buffer with diary entries.
Searches the file named in `diary-file' for entries that
match ARG days starting with the date indicated by the cursor position
in the displayed three-month calendar."
(interactive "p")
(let ((d-file (substitute-in-file-name diary-file)))
(if (and d-file (file-exists-p d-file))
(if (file-readable-p d-file)
(list-diary-entries (calendar-cursor-to-date t) arg)
(error "Diary file is not readable!"))
(error "You don't have a diary file!"))))
(defun view-other-diary-entries (arg diary-file)
"Prepare and display buffer of diary entries from an alternative diary file.
Prompts for a file name and searches that file for entries that match ARG
days starting with the date indicated by the cursor position in the displayed
three-month calendar."
(interactive
(list (cond ((null current-prefix-arg) 1)
((listp current-prefix-arg) (car current-prefix-arg))
(t current-prefix-arg))
(setq diary-file (read-file-name "Enter diary file name: "
default-directory nil t))))
(view-diary-entries arg))
(autoload 'check-calendar-holidays "holidays"
"Check the list of holidays for any that occur on DATE.
The value returned is a list of strings of relevant holiday descriptions.
The holidays are those in the list `calendar-holidays'."
t)
(autoload 'calendar-holiday-list "holidays"
"Form the list of holidays that occur on dates in the calendar window.
The holidays are those in the list `calendar-holidays'."
t)
(autoload 'diary-french-date "cal-french"
"French calendar equivalent of date diary entry."
t)
(autoload 'diary-mayan-date "cal-mayan"
"Mayan calendar equivalent of date diary entry."
t)
(autoload 'diary-iso-date "cal-iso"
"ISO calendar equivalent of date diary entry."
t)
(autoload 'diary-julian-date "cal-julian"
"Julian calendar equivalent of date diary entry."
t)
(autoload 'diary-astro-day-number "cal-julian"
"Astronomical (Julian) day number diary entry."
t)
(autoload 'diary-chinese-date "cal-china"
"Chinese calendar equivalent of date diary entry."
t)
(autoload 'diary-islamic-date "cal-islam"
"Islamic calendar equivalent of date diary entry."
t)
(autoload 'list-islamic-diary-entries "cal-islam"
"Add any Islamic date entries from the diary file to `diary-entries-list'."
t)
(autoload 'mark-islamic-diary-entries "cal-islam"
"Mark days in the calendar window that have Islamic date diary entries."
t)
(autoload 'mark-islamic-calendar-date-pattern "cal-islam"
"Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR."
t)
(autoload 'diary-hebrew-date "cal-hebrew"
"Hebrew calendar equivalent of date diary entry."
t)
(autoload 'diary-omer "cal-hebrew"
"Omer count diary entry."
t)
(autoload 'diary-yahrzeit "cal-hebrew"
"Yahrzeit diary entry--entry applies if date is yahrzeit or the day before."
t)
(autoload 'diary-parasha "cal-hebrew"
"Parasha diary entry--entry applies if date is a Saturday."
t)
(autoload 'diary-rosh-hodesh "cal-hebrew"
"Rosh Hodesh diary entry."
t)
(autoload 'list-hebrew-diary-entries "cal-hebrew"
"Add any Hebrew date entries from the diary file to `diary-entries-list'."
t)
(autoload 'mark-hebrew-diary-entries "cal-hebrew"
"Mark days in the calendar window that have Hebrew date diary entries."
t)
(autoload 'mark-hebrew-calendar-date-pattern "cal-hebrew"
"Mark dates in calendar window that conform to Hebrew date MONTH/DAY/YEAR."
t)
(autoload 'diary-coptic-date "cal-coptic"
"Coptic calendar equivalent of date diary entry."
t)
(autoload 'diary-ethiopic-date "cal-coptic"
"Ethiopic calendar equivalent of date diary entry."
t)
(autoload 'diary-persian-date "cal-persia"
"Persian calendar equivalent of date diary entry."
t)
(autoload 'diary-phases-of-moon "lunar" "Moon phases diary entry." t)
(autoload 'diary-sunrise-sunset "solar"
"Local time of sunrise and sunset as a diary entry."
t)
(autoload 'diary-sabbath-candles "solar"
"Local time of candle lighting diary entry--applies if date is a Friday.
No diary entry if there is no sunset on that date."
t)
(defvar diary-syntax-table (copy-syntax-table (standard-syntax-table))
"The syntax table used when parsing dates in the diary file.
It is the standard syntax table used in Fundamental mode, but with the
syntax of `*' changed to be a word constituent.")
(modify-syntax-entry ?* "w" diary-syntax-table)
(defun list-diary-entries (date number)
"Create and display a buffer containing the relevant lines in diary-file.
The arguments are DATE and NUMBER; the entries selected are those
for NUMBER days starting with date DATE. The other entries are hidden
using selective display.
Returns a list of all relevant diary entries found, if any, in order by date.
The list entries have the form ((month day year) string). If the variable
`diary-list-include-blanks' is t, this list includes a dummy diary entry
\(consisting of the empty string) for a date with no diary entries.
After the list is prepared, the hooks `nongregorian-diary-listing-hook',
`list-diary-entries-hook', `diary-display-hook', and `diary-hook' are run.
These hooks have the following distinct roles:
`nongregorian-diary-listing-hook' can cull dates from the diary
and each included file. Usually used for Hebrew or Islamic
diary entries in files. Applied to *each* file.
`list-diary-entries-hook' adds or manipulates diary entries from
external sources. Used, for example, to include d